package com.caucho.hessian.service;

import java.net.MalformedURLException;

import com.caucho.hessian.client.HessianProxyFactory;

public class HessianService {
	
	public static <T> T call(Class<T> clazz,String urlString) throws MalformedURLException{
		return call(clazz,urlString,false);
	}
	@SuppressWarnings("unchecked")
	public static <T> T call(Class<T> clazz,String urlString,Boolean isOverloadEnabled) throws MalformedURLException{
		HessianProxyFactory factory = new HessianProxyFactory();
		factory.setConnectTimeout(60000);// GAE限制最大请求延迟60秒
		factory.setReadTimeout(60000);
		factory.setOverloadEnabled(isOverloadEnabled);
		return (T)factory.create(clazz, urlString);
	}

}
